<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="mathjax," />





  <link rel="alternate" href="/blog/atom.xml" title="稻草人的编程之路" type="application/atom+xml" />






<meta name="description" content="mathjax由于在写博客的过程中经常要用到公式，本人记录该博客用于帮助自己熟悉公式表示的各种方式，同时如果能够帮助到大家，则更好 hexo + next + mathjax在使用hexo + next的过程，我发现写的mathjax表达式根本就不生效，在网上也查询了各种资料，使用了复杂的方式使之生效。本人比较懒，没有去试验那么多，就切换了一下markdown的渲染引擎，默认为 hexo-rend">
<meta name="keywords" content="mathjax">
<meta property="og:type" content="article">
<meta property="og:title" content="mathjax">
<meta property="og:url" content="https://wangxiaochuang.github.io/2018/10/14/1.html">
<meta property="og:site_name" content="稻草人的编程之路">
<meta property="og:description" content="mathjax由于在写博客的过程中经常要用到公式，本人记录该博客用于帮助自己熟悉公式表示的各种方式，同时如果能够帮助到大家，则更好 hexo + next + mathjax在使用hexo + next的过程，我发现写的mathjax表达式根本就不生效，在网上也查询了各种资料，使用了复杂的方式使之生效。本人比较懒，没有去试验那么多，就切换了一下markdown的渲染引擎，默认为 hexo-rend">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-01-07T22:36:29.352Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="mathjax">
<meta name="twitter:description" content="mathjax由于在写博客的过程中经常要用到公式，本人记录该博客用于帮助自己熟悉公式表示的各种方式，同时如果能够帮助到大家，则更好 hexo + next + mathjax在使用hexo + next的过程，我发现写的mathjax表达式根本就不生效，在网上也查询了各种资料，使用了复杂的方式使之生效。本人比较懒，没有去试验那么多，就切换了一下markdown的渲染引擎，默认为 hexo-rend">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://wangxiaochuang.github.io/2018/10/14/1.html"/>





  <title>mathjax | 稻草人的编程之路</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">稻草人的编程之路</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">众人皆醉我独醒 举世皆浊我独清</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://wangxiaochuang.github.io/blog/2018/10/14/1.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="jackstraw">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/blog/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="稻草人的编程之路">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">mathjax</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-10-14T12:42:18+00:00">
                2018-10-14
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/工具/" itemprop="url" rel="index">
                    <span itemprop="name">工具</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/工具/markdown/" itemprop="url" rel="index">
                    <span itemprop="name">markdown</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/工具/markdown/mathjax/" itemprop="url" rel="index">
                    <span itemprop="name">mathjax</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/blog/2018/10/14/1.html#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/blog/2018/10/14/1.html" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/blog/2018/10/14/1.html" class="leancloud_visitors" data-flag-title="mathjax">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数&#58;</span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="mathjax"><a href="#mathjax" class="headerlink" title="mathjax"></a>mathjax</h1><p>由于在写博客的过程中经常要用到公式，本人记录该博客用于帮助自己熟悉公式表示的各种方式，同时如果能够帮助到大家，则更好</p>
<h2 id="hexo-next-mathjax"><a href="#hexo-next-mathjax" class="headerlink" title="hexo + next + mathjax"></a>hexo + next + mathjax</h2><p>在使用hexo + next的过程，我发现写的mathjax表达式根本就不生效，在网上也查询了各种资料，使用了复杂的方式使之生效。本人比较懒，没有去试验那么多，就切换了一下markdown的渲染引擎，默认为 <code>hexo-renderer-marked</code>，切换后的引擎为 <code>hexo-renderer-kramed</code>，然后就生效了</p>
<ol>
<li>切换引擎</li>
</ol>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">npm uninstall hexo-renderer-marked --save</span><br><span class="line">npm install hexo-renderer-kramed --save</span><br></pre></td></tr></table></figure>
<ol>
<li>修改next主体的配置文件<code>_config.yml</code></li>
</ol>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 开启 mathjax 支持，搜索mathjax即可找到</span></span><br><span class="line"><span class="built_in">enable</span>: <span class="literal">true</span></span><br><span class="line">per_page: <span class="literal">true</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 或者不对每个页面都启用mathjax，将per_page设置为false</span></span><br><span class="line"><span class="comment"># 在每个博客的头信息中加上 mathjax: true</span></span><br></pre></td></tr></table></figure>
<h3 id="markdown与mathjax的冲突"><a href="#markdown与mathjax的冲突" class="headerlink" title="markdown与mathjax的冲突"></a>markdown与mathjax的冲突</h3><p>由于hexo在渲染的过程中会把一些markdown的符号（下划线 <code>_，*，{，}，\\</code> 等）渲染为响应的html标签，而这些又是mathjax要用的，因此产生冲突</p>
<p>如何解决呢？</p>
<p>修改 <code>node_modules\kramed\lib\rules\inline.js</code> 文件<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">1. 修改第11行</span><br><span class="line">//escape: /^\\([\\`*&#123;&#125;\[\]()#$+\-.!_&gt;])/,</span><br><span class="line">escape: /^\\([`*\[\]()#$+\-.!_&gt;])/,</span><br><span class="line">2. 修改第20行</span><br><span class="line">//em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,</span><br><span class="line">em: /^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,</span><br></pre></td></tr></table></figure></p>
<h2 id="语法"><a href="#语法" class="headerlink" title="语法"></a>语法</h2><h3 id="一个简单的例子"><a href="#一个简单的例子" class="headerlink" title="一个简单的例子"></a>一个简单的例子</h3><ol>
<li><p>行内（inline）公式 $d = \sqrt { (q_1 - p_1)^2 + (q_2 - p_2)^2 + {\cdots} + (q_n - p_n)^2 }$</p>
</li>
<li><p>独行显示公式</p>
</li>
</ol>
<script type="math/tex; mode=display">
d = \sqrt { (q_1 - p_1)^2 + (q_2 - p_2)^2 + {\cdots} + (q_n - p_n)^2 }</script><h3 id="一些特殊符号列表"><a href="#一些特殊符号列表" class="headerlink" title="一些特殊符号列表"></a>一些特殊符号列表</h3><ol>
<li>希腊字母</li>
</ol>
<div class="table-container">
<table>
<thead>
<tr>
<th>显示</th>
<th>命令</th>
<th>显示</th>
<th>命令</th>
<th>显示</th>
<th>命令</th>
</tr>
</thead>
<tbody>
<tr>
<td>α</td>
<td>\alpha</td>
<td>β</td>
<td>\beta</td>
<td>ν</td>
<td>\nu</td>
</tr>
<tr>
<td>ξ</td>
<td>\xi</td>
<td>γ</td>
<td>\gamma</td>
<td>δ</td>
<td>\delta</td>
</tr>
<tr>
<td>ε</td>
<td>\epsilon</td>
<td>ζ</td>
<td>\zeta</td>
<td>η</td>
<td>\eta</td>
</tr>
<tr>
<td>θ</td>
<td>\theta</td>
<td>ι</td>
<td>\iota</td>
<td>κ</td>
<td>\kappa</td>
</tr>
<tr>
<td>λ</td>
<td>\lambda</td>
<td>μ</td>
<td>\mu</td>
<td>π</td>
<td>\pi</td>
</tr>
<tr>
<td>ρ</td>
<td>\rho</td>
<td>σ</td>
<td>\sigma</td>
<td>τ</td>
<td>\tau</td>
</tr>
<tr>
<td>υ</td>
<td>\upsilon</td>
<td>φ</td>
<td>\phi</td>
<td>χ</td>
<td>\chi</td>
</tr>
<tr>
<td>ψ</td>
<td>\psi</td>
<td>ω</td>
<td>\omega</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<ol>
<li>特殊符号</li>
</ol>
<div class="table-container">
<table>
<thead>
<tr>
<th>显示</th>
<th>命令</th>
<th>显示</th>
<th>命令</th>
<th>显示</th>
<th>命令</th>
</tr>
</thead>
<tbody>
<tr>
<td>∞</td>
<td>\infty</td>
<td>∪</td>
<td>\cup</td>
<td>∩</td>
<td>\cap</td>
</tr>
<tr>
<td>⊂</td>
<td>\subset</td>
<td>⊆</td>
<td>\subseteq</td>
<td>⊃</td>
<td>\supset</td>
</tr>
<tr>
<td>∈</td>
<td>\in</td>
<td>∉</td>
<td>\notin</td>
<td>∅</td>
<td>\varnothing</td>
</tr>
<tr>
<td>∀</td>
<td>\forall</td>
<td>∃</td>
<td>\exists</td>
<td>¬</td>
<td>\lnot</td>
</tr>
<tr>
<td>∇</td>
<td>\nabla</td>
<td>∂</td>
<td>\partial</td>
<td>$\cdots$</td>
<td>\cdots </td>
</tr>
<tr>
<td>$\vdots$</td>
<td>\vdots</td>
<td>$\ddots$</td>
<td>\ddots</td>
<td>$\to$</td>
<td>\to</td>
</tr>
<tr>
<td>$\times$</td>
<td>\times</td>
<td>$\bar x$</td>
<td>\bar x</td>
<td>$\overline{xyz}$</td>
<td>\overline{xyz}</td>
</tr>
<tr>
<td>$\lceil x \rceil$</td>
<td>\lceil x \rceil</td>
<td>$\lfloor x \rfloor$</td>
<td>\lfloor x \rfloor</td>
<td>$\hat{y}$</td>
<td>\hat{y}</td>
</tr>
<tr>
<td>${n+1 \choose 2k}</td>
<td>{n+1 \choose 2k} 或 \binom{n+1}{2k}</td>
<td>$\leftarrow$</td>
<td>\leftarrow</td>
<td>$\cdot$</td>
<td>\cdot</td>
</tr>
</tbody>
</table>
</div>
<h3 id="修饰与分组"><a href="#修饰与分组" class="headerlink" title="修饰与分组"></a>修饰与分组</h3><ol>
<li>上下标</li>
</ol>
<p>使用 ^（上标） _（下标），如 <code>A_n^3</code> 结果为 $A_n^3$  </p>
<ol>
<li><p>各种括号</p>
<ol>
<li>小括号：<code>(a + b)</code> 结果为 $(a + b)$</li>
<li>中括号：<code>[a + b]</code> 结果为 $[a + b]$</li>
<li>尖括号：<code>\langle a + b \rangle</code> 结果为 $\langle a + b \rangle$</li>
<li><p>大括号： <code>\left( \frac{x}{y} \right)</code> 结果为 $\left( \frac{x}{y} \right)$</p>
<p> 可以对比一下 <code>( \frac{x}{y} )</code> 结果为 $( \frac{x}{y} )$</p>
</li>
</ol>
</li>
</ol>
<ol>
<li>分组</li>
</ol>
<p>分组是什么意思呢，比如根号下的所有内容就应该是一个组，再比如排列组合公式的上小数值就应该分别是两个组</p>
<ol>
<li>特殊函数</li>
</ol>
<p>每个函数都有一个对应的名字，使用 <code>\函数名</code> 的形式表示</p>
<div class="table-container">
<table>
<thead>
<tr>
<th>函数</th>
<th>表达式</th>
<th>结果</th>
</tr>
</thead>
<tbody>
<tr>
<td>求累和</td>
<td><code>\sum_{i = 1}^{n}{x_i}</code></td>
<td>$\sum_{i=1}^{n}{x_i}$</td>
</tr>
<tr>
<td>求累积</td>
<td><code>\prod_{i = 1}^{n}{x_i}</code></td>
<td>$\prod_{i=1}^{n}{x_i}$</td>
</tr>
<tr>
<td>求极限</td>
<td><code>\lim_{x \to 0}</code></td>
<td>$\lim_{x \to 0}$</td>
</tr>
<tr>
<td>求积分</td>
<td><code>\int_0^\infty{dx}</code></td>
<td>$\int_0^\infty{dx}$</td>
</tr>
<tr>
<td>分数除</td>
<td><code>\frac{x}{y}</code></td>
<td>$\frac{x}{y}$</td>
</tr>
<tr>
<td>求根式</td>
<td><code>\sqrt[x]{y}</code></td>
<td>$\sqrt[x]{y}$</td>
</tr>
<tr>
<td>sin函数</td>
<td><code>\sin x</code></td>
<td>$\sin x$</td>
</tr>
<tr>
<td>ln函数</td>
<td><code>\ln x</code></td>
<td>$\ln x$</td>
</tr>
<tr>
<td>max函数</td>
<td><code>\max(x, y, z)</code></td>
<td>$\max(x, y, z)$</td>
</tr>
<tr>
<td>min函数</td>
<td><code>\min(x, y, z)</code></td>
<td>$\min(x, y, z)$</td>
</tr>
</tbody>
</table>
</div>
<ol>
<li><p>字体</p>
<ol>
<li><code>{𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉1234567890}</code><br> ${𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉1234567890}$</li>
<li><code>\cal{𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉1234567890}</code><br> $\cal {𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉1234567890}$</li>
</ol>
</li>
<li><p>矢量符号</p>
</li>
</ol>
<p>\vec a 结果为 $\vec a$</p>
<ol>
<li>添加文字</li>
</ol>
<p>添加文字</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">$$\left. \begin&#123;array&#125;&#123;1&#125;</span><br><span class="line">\text&#123;if $n$ is even:&#125;&amp;n/2 \\</span><br><span class="line">\text&#123;if $n$ is odd:&#125;&amp;3n+1</span><br><span class="line">\end&#123;array&#125; \right\&#125; = f(n)$$</span><br></pre></td></tr></table></figure>
<p>结果为</p>
<script type="math/tex; mode=display">\left. \begin{array}{1}
\text{if $n$ is even:}&n/2 \\
\text{if $n$ is odd:}&3n+1
\end{array} \right\} = f(n)</script><h3 id="多行公式"><a href="#多行公式" class="headerlink" title="多行公式"></a>多行公式</h3><p>代码如下：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">\begin&#123;equation&#125;\begin&#123;split&#125;</span><br><span class="line">y &amp;= \frac &#123;x^2 + 1&#125; &#123;x&#125; \\</span><br><span class="line">&amp;= x + \frac&#123;1&#125;&#123;x&#125;</span><br><span class="line">\end&#123;split&#125;\end&#123;equation&#125;</span><br></pre></td></tr></table></figure></p>
<p>结果如下：<br>\begin{equation}\begin{split}<br>y &amp;= \frac {x^2 + 1} {x} \\<br>&amp;= x + \frac{1}{x}<br>\end{split}\end{equation}</p>
<h3 id="空格"><a href="#空格" class="headerlink" title="空格"></a>空格</h3><p>如果我们自己输入空格，mathjax会忽略，那我们如何输入空格呢</p>
<ol>
<li><p>小空格</p>
<p> x\ y 结果为 $x\ y$</p>
</li>
<li><p>四空格</p>
<p> x\quad y 结果为 $x\quad y$</p>
</li>
</ol>
<p>也可以使用多个小空格</p>
<h3 id="使用矩阵"><a href="#使用矩阵" class="headerlink" title="使用矩阵"></a>使用矩阵</h3><ol>
<li>起始标记 <code>\begin{matrix}</code>，结束标记 <code>\end{matrix}</code></li>
<li>每行的末尾需要标记 <code>\\</code>，行间元素之间以 <code>&amp;</code> 分割</li>
<li>如</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">$$\begin&#123;matrix&#125;</span><br><span class="line">1 &amp; 0 &amp; 0 \\</span><br><span class="line">0 &amp; 1 &amp; 0 \\</span><br><span class="line">0 &amp; 0 &amp; 1 \\</span><br><span class="line">\end&#123;matrix&#125;$$</span><br></pre></td></tr></table></figure>
<p>结果为：</p>
<script type="math/tex; mode=display">\begin{matrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\
\end{matrix}</script><ol>
<li><p>添加括号</p>
<ol>
<li>pmatrix: 小括号边框</li>
<li>bmatrix: 中括号边框</li>
<li>Bmatrix: 大括号边框</li>
<li>vmatrix: 单竖线边框</li>
<li>Vmatrix: 双竖线边框</li>
</ol>
</li>
<li><p>列向量</p>
</li>
</ol>
<p>代码如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">$$</span><br><span class="line">(\theta_0 \quad \theta_1 \quad \theta_2) \quad \times \quad \begin&#123;bmatrix&#125;</span><br><span class="line">1 \\ </span><br><span class="line">x_1 \\ </span><br><span class="line">x_2</span><br><span class="line">\end&#123;bmatrix&#125; = \theta_0 + \theta_1 x_1 + \theta_2 x_2</span><br><span class="line">$$</span><br></pre></td></tr></table></figure>
<p>结果为</p>
<script type="math/tex; mode=display">
(\theta_0 \quad \theta_1 \quad \theta_2) \quad \times \quad \begin{bmatrix}
1 \\ 
x_1 \\ 
x_2
\end{bmatrix} = \theta_0 + \theta_1 x_1 + \theta_2 x_2</script><h3 id="阵列"><a href="#阵列" class="headerlink" title="阵列"></a>阵列</h3><ol>
<li>开始结束使用 <code>{array}</code> 声明</li>
<li>在 <code>{array}</code> 后以 <code>{}</code> 逐行统一声明对齐方式，左对齐（l），居中（c），右对齐（r），还可以插入竖线</li>
<li>插入水平线：<code>\hline</code></li>
<li>如下</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">$$\begin&#123;array&#125;&#123;c|ccc&#125;</span><br><span class="line">&amp; &#123;姓名&#125; &amp; &#123;性别&#125; &amp; &#123;年龄&#125; \\</span><br><span class="line">\hline</span><br><span class="line">&#123;1&#125; &amp; &#123;张三&#125; &amp; &#123;男&#125; &amp; &#123;27&#125; \\</span><br><span class="line">&#123;2&#125; &amp; &#123;李四&#125; &amp; &#123;女&#125; &amp; &#123;35&#125; \\</span><br><span class="line">\end&#123;array&#125;$$</span><br></pre></td></tr></table></figure>
<p>结果为：</p>
<script type="math/tex; mode=display">\begin{array}{c|ccc}
/ & {姓名} & {性别} & {年龄} \\
\hline
{1} & {张三} & {男} & {27} \\
{2} & {李四} & {女} & {35} \\
\end{array}</script><h3 id="方程组"><a href="#方程组" class="headerlink" title="方程组"></a>方程组</h3><ol>
<li>开始结束使用 <code>{case}</code> 声明</li>
<li>例如</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">$$\begin&#123;cases&#125;</span><br><span class="line">\alpha_1 x + \beta_1 y + \gamma_1 z = d_1 \\</span><br><span class="line">\alpha_2 x + \beta_2 y + \gamma_2 z = d_2 \\</span><br><span class="line">\alpha_3 x + \beta_3 y + \gamma_3 z = d_3 \\</span><br><span class="line">\end&#123;cases&#125;$$</span><br></pre></td></tr></table></figure>
<p>结果为：</p>
<script type="math/tex; mode=display">\begin{cases}
\alpha_1 x + \beta_1 y + \gamma_1 z = d_1 \\
\alpha_2 x + \beta_2 y + \gamma_2 z = d_2 \\
\alpha_3 x + \beta_3 y + \gamma_3 z = d_3 \\
\end{cases}</script>
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/mathjax/" rel="tag"># mathjax</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2018/10/05/1.html" rel="next" title="机器学习之knn">
                <i class="fa fa-chevron-left"></i> 机器学习之knn
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2018/10/15/1.html" rel="prev" title="机器学习之线性回归">
                机器学习之线性回归 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
    </div>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/blog/images/avatar.jpg"
                alt="jackstraw" />
            
              <p class="site-author-name" itemprop="name">jackstraw</p>
              <p class="site-description motion-element" itemprop="description">人生的意义，不在于最终获得了什么，而在于曾经努力追求过什么</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">19</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                
                  <span class="site-state-item-count">22</span>
                  <span class="site-state-item-name">分类</span>
                
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                
                  <span class="site-state-item-count">22</span>
                  <span class="site-state-item-name">标签</span>
                
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/blog/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#mathjax"><span class="nav-number">1.</span> <span class="nav-text">mathjax</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#hexo-next-mathjax"><span class="nav-number">1.1.</span> <span class="nav-text">hexo + next + mathjax</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#markdown与mathjax的冲突"><span class="nav-number">1.1.1.</span> <span class="nav-text">markdown与mathjax的冲突</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#语法"><span class="nav-number">1.2.</span> <span class="nav-text">语法</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#一个简单的例子"><span class="nav-number">1.2.1.</span> <span class="nav-text">一个简单的例子</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#一些特殊符号列表"><span class="nav-number">1.2.2.</span> <span class="nav-text">一些特殊符号列表</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#修饰与分组"><span class="nav-number">1.2.3.</span> <span class="nav-text">修饰与分组</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#多行公式"><span class="nav-number">1.2.4.</span> <span class="nav-text">多行公式</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#空格"><span class="nav-number">1.2.5.</span> <span class="nav-text">空格</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#使用矩阵"><span class="nav-number">1.2.6.</span> <span class="nav-text">使用矩阵</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#阵列"><span class="nav-number">1.2.7.</span> <span class="nav-text">阵列</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#方程组"><span class="nav-number">1.2.8.</span> <span class="nav-text">方程组</span></a></li></ol></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">jackstraw</span>

  
</div>









        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>访问人数
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      人
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>总访问量
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      次
    </span>
  
</div>








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  










  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: true,
        notify: false,
        appId: 'lQM75w94ggNR0TjX61NLerrg-gzGzoHsz',
        appKey: 'I2wtQ2rd9KtoJmcEOiYG9zqT',
        placeholder: '如需帮助，请留下邮箱',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
    var infoEle = document.querySelector('#comments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0){
      infoEle.childNodes.forEach(function(item) {
        item.parentNode.removeChild(item);
      });
    }
  </script>



  





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("lQM75w94ggNR0TjX61NLerrg-gzGzoHsz", "I2wtQ2rd9KtoJmcEOiYG9zqT");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  
  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  

</body>
</html>
